<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        .tab_con {
            width: 500px;
            height: 350px;
            margin: 50px auto 0;
        }

        .tab_btns {
            height: 50px;
        }

        .tab_btns input {
            width: 100px;
            height: 50px;
            background: #ddd;
            border: 0px;
            outline: none;
        }

        .tab_btns .active {
            background: gold;
        }

        .tab_cons {
            height: 300px;
            background: gold;
        }

        .tab_cons div {
            height: 300px;
            line-height: 300px;
            text-align: center;
            display: none;
            font-size: 30px;
        }

        .tab_cons .current {
            display: block;
        }
    </style>
</head>

<body>
    <div class="tab_con">
        <div class="tab_btns">
            <input type="button" value="按钮一" class="active">
            <input type="button" value="按钮二">
            <input type="button" value="按钮三">
        </div>
        <div class="tab_cons">
            <div class="current">按钮一对应的内容</div>
            <div>按钮二对应的内容</div>
            <div>按钮三对应的内容</div>
        </div>
    </div>
</body>
<script>
    let tabBtn = document.querySelector('.tab_btns');
    let tabCons = document.querySelector('.tab_cons')
    tabBtn.addEventListener('click', function (e) {
        for (var i = 0; i < tabBtn.children.length; i++) {
            tabBtn.children[i].classList.remove('active')
            tabCons.children[i].classList.remove('current')
            if (tabBtn.children[i] == e.target) {
                tabBtn.children[i].classList.add('active')
                tabCons.children[i].classList.add('current')
            }
        }
    })
</script>

</html>